function [R,R1,r] = switch_schemenumber_alt_Extended(schemenumber,nf,n,trend)

switch schemenumber

    case 5
        
    R1 = zeros(n,(nf)*(5+1));
    R1(1,trend+1) = 1;
    R1(:,1:trend+1:end) = 1;
    R3 = R1;
    R1 = R1';
    R1 = R1(:);

    R2 = eye(n*nf*(5+1));
    R = R2(:,logical(R1))';
    
    EYE = eye(trend);
    
    R4 = zeros(n,(nf)*(5+1));
    R4(1:trend,1:trend)=EYE;
    R4(1,trend+1) = 1;
    r = vec(R4');
    r(vec(R3')==0) = [];
    
    case 51
    
    R1 = zeros(n,(nf)*(5+1));
    R1(:,1:trend+1:end) = 1;

    R1(1,trend+1) = 1;
    R3 = R1;
    R1 = R1';
    R1 = R1(:);

    R2 = eye(n*nf*(5+1));
    R = R2(:,logical(R1))';
        
    R4 = zeros(n,(nf)*(5+1));
    R4(1:2,1) = 1;
    R4(1,trend+1) = 1;
    
    r = vec(R4');
    r(vec(R3')==0) = [];

   
    
end